{% extends 'products/base.html' %}
{% load static %}

{% block css %}
  <link href="{% static '/css/profile.css' %}" rel="stylesheet">
{% endblock %}

{% block content %}
  <div class="container">
    <div class="row">
        <div class="col-lg-7">
            <h4 class="mt-3 mb-3">Профиль</h4>
            <div class="col-lg-12 text-center">
                <img width="100" height="100"
                     src="{% if user.image %} {{ user.image.url }} {% else %} {% static 'vendor/img/users/default_avatar.jpeg' %} {% endif %}"
                     class="img-thumbnail">
            </div>
            <form action="{% url 'users:profile' %}" method="post" enctype="multipart/form-data">
              {% csrf_token %}
                <div class="form-row">
                    <div class="col-lg-6">
                        <div class="form-group">
                            <label class="small mb-1" for="{{ form.first_name.id_for_label }}">Имя</label>
                            {{ form.first_name }}
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="form-group">
                            <label class="small mb-1" for="{{ form.last_name.id_for_label }}">Фамилия</label>
                            {{ form.last_name }}
                        </div>
                    </div>
                </div>
                <div class="form-row mb-2">
                    <div class="col-lg-12">
                        <div class="custom-file">
                            {{ form.image }}
                            <label class="custom-file-label" for="{{ form.image.id_for_label }}">Выберите изображение</label>
                        </div>
                    </div>
                </div>
                <div class="form-row">
                    <div class="col-lg-6">
                        <label class="small mb-1" for="{{ form.username.id_for_label }}">Имя пользователя</label>
                        {{ form.username }}
                    </div>
                    <div class="col-lg-6">
                        <label class="small mb-1" for="{{ form.email.id_for_label }}">Адрес электронной
                            почты</label>
                        {{ form.email }}
                    </div>
                </div>
                <div class="form-row">
                    <div class="col-lg-12" style="margin-top: 33px;">
                        <input class="btn btn-info btn-block" type="submit" value="Сохранить">
                    </div>
                </div>
            </form>
        </div>
        {% include 'products/basket.html' %}
    </div>
  </div>
{% endblock %}